function setCookie(key, value, seconds, path = '/') {

  let data = new Date()
  data.setTime(data.getTime() - 8 * 3600 * 1000 + seconds * 1000)
  document.cookie = `${key}=${value};expires=${data};path=${path}`
}

function getCookie(key) {
  let cookies = document.cookie
  if (!cookies) return

  let cookiesArr = cookies.split('; ')
  for (let i = 0; i < cookiesArr.length; i++) {
    let brr = cookiesArr[i].split('=')

    if (brr[0] === key) return brr[1]
  }
}

function removeCookie(key, path = '/') {
  setCookie(key, null, -1, path)
}